package com.chen.controllers.windows;

import java.io.UnsupportedEncodingException;

import javax.servlet.http.HttpServletRequest;


import net.paoding.rose.web.Invocation;
import net.paoding.rose.web.annotation.Path;
import net.paoding.rose.web.annotation.rest.Get;
import net.paoding.rose.web.portal.Window;
/**
 * 测试传参
 * @author ninja.hzw
 */
@Path("testParameter")
public class ParameterController {

	// 方法名是什么不要紧，关进是@Get代表了这个方法用于处理对/testParameter的GET请求\
	// request 对象可以作为参数传入 也可以通过inv.getRequest() 获得。
	@Get
	public String test(Invocation inv, Window window , HttpServletRequest request) {
		
		try {
			inv.addModel("movie",request.getParameter("movie"));
			//url 直接传参会有乱码，进行转码
			inv.addModel("test", new String(request.getParameter("test").getBytes("iso8859-1"),"utf-8"));
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return "param_test";
	}
}
